package 创建者模式.工厂模式.简单工厂模式.after;

public class CoffeeFactory {
    public Coffee creatCoffee(String type) {
        Coffee coffee;
        if ("american".equals(type))
            coffee = new AmericanCoffee();
        else if ("latte".equals(type))
            coffee = new LatteCoffee();
        else
            throw new RuntimeException("对不起，您所点的咖啡没有");
        return coffee;
    }
}
